<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition >

        <p:fieldset legend="Purchase Order # #{purchaseOrderEntityController.selected.id}">
            <h:panelGrid columns="6">
                    <h:outputText value="#{bundle.ViewPurchaseOrderEntityLabel_customer}"/>
                    <p:commandLink ajax="false" value="#{purchaseOrderEntityController.selected.customer.firstName}&nbsp;#{purchaseOrderEntityController.selected.customer.lastName}" action="#{customerEntityController.viewCustomerFromPO}" title="#{bundle.ViewPurchaseOrderEntityTitle_customer}"/>
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="Customer Id:"/>
                    <h:outputText value="#{purchaseOrderEntityController.selected.customer}" title="#{bundle.ViewPurchaseOrderEntityTitle_customer}"/>
                    <h:outputText value="Customer Executive:"/>
                    <h:outputText value="#{purchaseOrderEntityController.selected.customer.customerExecutive.firstName}&nbsp;#{purchaseOrderEntityController.selected.customer.customerExecutive.lastName}"/>
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="#{bundle.ViewPurchaseOrderEntityLabel_salesQuotation}"/>
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesQuotation}" title="#{bundle.ViewPurchaseOrderEntityTitle_salesQuotation}"/>
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="#{bundle.ViewPurchaseOrderEntityLabel_salesOrder}"/>
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesOrder}" title="#{bundle.ViewPurchaseOrderEntityTitle_salesOrder}" rendered="#{purchaseOrderEntityController.selected.salesOrder!=null}"/>
                    <h:outputText value="*Sales Order Not Created" style="color:red" title="#{bundle.ViewPurchaseOrderEntityTitle_salesOrder}" rendered="#{purchaseOrderEntityController.selected.salesOrder==null}"/>
                </h:panelGrid>
                <br />
                <p:separator/>
                <br />
                <p:fieldset legend="Customer Preference">
                    <h:panelGrid columns="2">
                        <h:outputText value="Customer's preferred shipping date:"/>
                        <h:outputText value="#{purchaseOrderEntityController.selected.preferredLeadTime}" title="#{bundle.ViewPurchaseOrderEntityTitle_preferredLeadTime}">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </h:panelGrid>
                </p:fieldset>
                <br />
                <p:dataTable value="#{purchaseOrderEntityController.selected.productQuantityPrice}" var="pqp" style="border:solid 1px">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Product"/>
                        </f:facet>
                        <h:outputText value="#{pqp.product.productName}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Quantity"/>
                        </f:facet>
                        <h:outputText value="#{pqp.quantity}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Price Per Unit (S$)"/>
                        </f:facet>
                        <h:outputText value="#{pqp.pricePerUnit}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Sub Total Price (S$)"/>
                        </f:facet>
                        <h:outputText value="#{pqp.price}"/>
                    </p:column>
                    <p:columnGroup type="footer">  
                        <p:row>  
                            <p:column colspan="3" footerText="Total Price:"  
                                      style="text-align:left"  />  

                            <p:column footerText="S$ #{purchaseOrderEntityController.selected.totalPrice}" style="text-align:left" />  

                        </p:row>  
                    </p:columnGroup>
                </p:dataTable>
        </p:fieldset>
        <br />
        <p:fieldset legend="Sales Quotation # #{purchaseOrderEntityController.selected.salesQuotation.id}">
            <h:panelGrid columns="6">
                    <h:outputText value="Price Validity:" />
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesQuotation.validity}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.validity!=null}"/>
                    <h:outputText value="*Validity Period Not Set*" style="color:red" rendered="#{purchaseOrderEntityController.selected.salesQuotation.validity==null}"/>
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="System User:" />
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesQuotation.systemUser.firstName}&nbsp;#{purchaseOrderEntityController.selected.salesQuotation.systemUser.lastName}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.systemUser!=null}"/>
                    <h:outputText value="*Price Not Quoted*" style="color:red" rendered="#{purchaseOrderEntityController.selected.salesQuotation.systemUser==null}"/>

                    <h:outputText value="Status:"/>
                    <h:outputText value="Invalid" rendered="#{purchaseOrderEntityController.selected.salesQuotation.valid==false}"/>
                    <h:outputText value="Valid" rendered="#{purchaseOrderEntityController.selected.salesQuotation.valid==true}"/>
                    <h:outputText value="" />
                    <h:outputText value="" />
                    <h:outputText value="Indicative Lead Time:"/>
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesQuotation.indicativeLeadTime}" title="#{bundle.ViewSalesQuotationEntityTitle_indicativeLeadTime}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.indicativeLeadTime!=null}"/>
                    <h:outputText value="*Date Not Given*" style="color:red" rendered="#{purchaseOrderEntityController.selected.salesQuotation.indicativeLeadTime==null}"/>

                    <h:outputText value="#{bundle.ViewSalesQuotationEntityLabel_customer}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}"/>
                    <p:commandLink ajax="false" value="#{purchaseOrderEntityController.selected.salesQuotation.customer.firstName}&nbsp;#{purchaseOrderEntityController.selected.salesQuotation.customer.lastName}" action="#{customerEntityController.viewCustomerFromPO}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}"/>
                    <h:outputText value="" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}"/>
                    <h:outputText value="" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}"/>
                    <h:outputText value="Customer Id:" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}" />
                    <h:outputText value="#{purchaseOrderEntityController.selected.salesQuotation.customer}" rendered="#{purchaseOrderEntityController.selected.salesQuotation.customer!=null}"/>

                </h:panelGrid>
                <p:dataTable value="#{purchaseOrderEntityController.selected.salesQuotation.pqp}" var="pqp" style="border:solid 1px">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Product"/>
                        </f:facet>
                        <h:outputText value="#{pqp.product.productName}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Quantity"/>
                        </f:facet>
                        <h:outputText value="#{pqp.quantity}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Price Per Unit (S$)"/>
                        </f:facet>
                        <h:outputText value="#{pqp.pricePerUnit}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Sub Total Price (S$)"/>
                        </f:facet>
                        <h:outputText value="#{pqp.price}"/>
                    </p:column>
                    <p:columnGroup type="footer">  
                        <p:row>  
                            <p:column colspan="3" footerText="Total Price:"  
                                      style="text-align:left"  />  

                            <p:column footerText="S$ #{purchaseOrderEntityController.selected.salesQuotation.totalPrice}" style="text-align:left" />  

                        </p:row>  
                    </p:columnGroup>
                </p:dataTable>
        </p:fieldset>

    </ui:composition>

</html>
